package com.bh.order.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bh.common.utils.DateUtils;
import com.bh.order.domain.JcOrderArrive;
import com.bh.order.mapper.JcOrderArriveMapper;
import com.bh.order.service.IJcOrderArriveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 货品到站记录Service业务层处理
 *
 * @author slx
 * @date 2023-04-22
 */

@Service
public class JcOrderArriveServiceImpl extends ServiceImpl<JcOrderArriveMapper, JcOrderArrive> implements IJcOrderArriveService {
    @Autowired
    private JcOrderArriveMapper jcOrderArriveMapper;

    /**
     * 查询货品到站记录
     *
     * @param id 货品到站记录主键
     * @return 货品到站记录
     */
    @Override
    public JcOrderArrive selectJcOrderArriveById(Long id) {
        return jcOrderArriveMapper.selectById(id);
    }

    /**
     * 查询货品到站记录列表
     *
     * @param jcOrderArrive 货品到站记录
     * @return 货品到站记录
     */
    @Override
    public List<JcOrderArrive> selectJcOrderArriveList(JcOrderArrive jcOrderArrive) {
        return jcOrderArriveMapper.selectJcOrderArriveList(jcOrderArrive);
    }

    /**
     * 新增货品到站记录
     *
     * @param jcOrderArrive 货品到站记录
     * @return 结果
     */
    @Override
    public int insertJcOrderArrive(JcOrderArrive jcOrderArrive) {
        jcOrderArrive.setCreateTime(DateUtils.getNowDate());
        return jcOrderArriveMapper.insert(jcOrderArrive);
    }

    /**
     * 修改货品到站记录
     *
     * @param jcOrderArrive 货品到站记录
     * @return 结果
     */
    @Override
    public int updateJcOrderArrive(JcOrderArrive jcOrderArrive) {
        return jcOrderArriveMapper.updateById(jcOrderArrive);
    }

    /**
     * 批量删除货品到站记录
     *
     * @param ids 需要删除的货品到站记录主键
     * @return 结果
     */
    @Override
    public int deleteJcOrderArriveByIds(Long[] ids) {
        return jcOrderArriveMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除货品到站记录信息
     *
     * @param id 货品到站记录主键
     * @return 结果
     */
    @Override
    public int deleteJcOrderArriveById(Long id) {
        return jcOrderArriveMapper.deleteById(id);
    }
}
